const quest = function (authorization, url = '', params = {}, scall = (res) => { }, fcall = (res) => { }, method = 'POST') {
  wx.request({
    url: 'https://www.hardslove.com' + url,
    header: {
      'content-type': 'application/x-www-form-urlencoded',
      'authorization': authorization// 默认值
    },
    data: params,
    method: method,
    success: result => {
      let res = result.data
      wx.hideLoading()
      if (res.code === 200) {
        scall(res)
      }
      else {
        wx.showModal({
          title: '提示',
          content: res.msg || '返回出错，请稍后再试',
          success: () => {
            fcall(res)
          }
        })
      }
    },
    fail: res => {
      wx.hideLoading()
      wx.showModal({
        title: '提示',
        content: '访问超时，请稍后再试',
      })
      fcall(res)
    }
  })
}
module.exports = {
  quest: quest
}